package com.edocbase.desktop;

import org.eclipse.swt.widgets.Display;

public abstract class DesktopAdvisor {
	public void eventLoopIdle(Display display) {
		// default: yield cpu until new events enter the queue
		display.sleep();
	}
	
	public void eventLoopException(Throwable exception) {
		// Protection from client doing super(null) call
		if (exception == null) {
			return;
		}

		try {
			// StatusManager.getManager().handle(
			// new Status(IStatus.ERROR, WorkbenchPlugin.PI_WORKBENCH,
			//							"Unhandled event loop exception", exception)); //$NON-NLS-1$

			exception.printStackTrace();
		} catch (Throwable e) {
			// One of the log listeners probably failed. Core should have logged
			// the
			// exception since its the first listener.
			System.err.println("Error while logging event loop exception:"); //$NON-NLS-1$
			exception.printStackTrace();
			System.err.println("Logging exception:"); //$NON-NLS-1$
			e.printStackTrace();
		}
	}

	public boolean shellClose() {
		return true;
	}

	public void postShutdown() {
		
	}

	public abstract void createUI(Display display, Desktop desktop);
	
}
